package com.tg.message.adapter;

import android.annotation.SuppressLint;

import androidx.annotation.NonNull;

import com.appbase.custom.base.MessageFilterBean;
import com.tg.data.bean.DeviceItem;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

public class MessageEventAdapter extends DateAdapter{
    private final List<MessageFilterBean> list;
    public MessageEventAdapter(List<MessageFilterBean>  data) {
       list = data;
    }

    @Override
    public void onBindViewHolder(@NonNull MessageDateViewHolder holder, @SuppressLint("RecyclerView") final int position) {
        MessageFilterBean messageFilterBean = list.get(position);
        holder.dateText.setText(messageFilterBean.name);
        super.onBindViewHolder(holder, position);
    }

    public String getDateText(int position){
        MessageFilterBean messageFilterBean = list.get(position);
        return messageFilterBean.name;
    }

    @Override
    public int getItemCount() {
        return list == null ? 0 : list.size();
    }

    public List<String> getEvent() {
        List<String> arrayList = new ArrayList<>();
        if (selectedDay < list.size() && selectedDay > 0) {
            arrayList.add(list.get(selectedDay).event);
        }else {
            for (MessageFilterBean messageFilterBean : list) {
                arrayList.add(messageFilterBean.event);
            }

        }
        return arrayList;
    }


}
